package 招聘.阿里巴巴.秋季校招2019;

import java.util.*;

class Node {
    char c;
    Node front;

    public Node(char s, Node front, Node next) {
        this.c = s;
        this.front = front;
        this.next = next;
    }

    Node next;

}

public class Main {
    static int usersLength;
/** 请完成下面这个函数，实现题目要求的功能 **/
    /**
     * 当然，你也可以不按照这个模板来作答，完全按照自己的想法来 ^-^
     **/
    static String getIndexAndLongest(String users, int t) {
        usersLength = users.length();
        int[] gc = new int[users.length()];
        for (int i = 0; i < users.length(); i++) {

            int j;
            if (users.charAt(i) == 'b') {
                j = i;
                while (users.charAt(frontNumber(j)) == 'g') {
                    j = frontNumber(j);
                    gc[i]++;
                }
                j = i;
                while (users.charAt(nextNumber(j)) == 'g') {
                    j = nextNumber(j);
                    gc[i]++;
                }
            }
        }
        int max = 0;
        int maxIndex = 0;

        for (int i = 0; i < gc.length; i++) {

            if (gc[i] > max) {
                max = gc[i];
                maxIndex = i;
            }
        }
        System.out.println(maxIndex);

        int[] bf = new int[users.length()];

        for (int i = 0; i < users.length(); i++) {
            int j;
            if (users.charAt(i) == 'g') {
                j = i;
                while (users.charAt(frontNumber(j)) == 'b') {
                    j = frontNumber(j);
                    bf[i]++;
                }
            }
        }
        int maxRes = 0;
        for (int i = 0; i < users.length(); i++) {
            int count = t;
            int res = 0;
            for (int j = i; count != 0; j = nextNumber(j)) {
                if (bf[j] != 0) {
                    count--;
                    res+=bf[j];
                }
            }
            if(res>maxRes)
                maxRes=res;

        }
        return maxIndex+" "+maxRes+1;
    }

    static int frontNumber(int j) {
        if (j == 0) {
            return usersLength - 1;
        } else {
            return j - 1;
        }
    }

    static int nextNumber(int j) {
        if (j == usersLength - 1) {
            return 0;
        } else {
            return j + 1;
        }
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String res;

        String _users;
        try {
            _users = in.nextLine();
        } catch (Exception e) {
            _users = null;
        }
        int t = in.nextInt();
        res = getIndexAndLongest(_users, t);
        System.out.println(res);
    }
}